#pragma once

#include "LvWindow.h"
#include "LvDevice.hpp"
#include "LvPipeline.h"
#include "LvSwapChain.hpp"
#include "LvModel.h"

#define GLM_FORCE_RADIANS
#define GLM_FORCE_DEPTH_ZERO_TO_ONE
#include <glm/glm.hpp>

#include <memory>
#include <vector>


struct SimplePushConstantData
{
	glm::vec2 offset;
	alignas(16) glm::vec3 color;
};

class TriangleApp
{
public:
	static constexpr int WIDTH = 800;
	static constexpr int HEIGHT = 600;

	TriangleApp();
	~TriangleApp();

	TriangleApp(const TriangleApp&) = delete;
	TriangleApp& operator=(const TriangleApp&) = delete;

	void run();

private:
	void loadModels();
	void createPipelineLayout();
	void createPipeline();
	void createCommandBuffers();
	void freeCommandBuffers();
	void drawFrame();
	void recreateSwapChain();
	void recordCommandBuffer(uint32_t imageIndex);



	LvWindow lvWindow{WIDTH, HEIGHT, "Hello Vulkan Triangle"};
	LvDevice lvDevice{ lvWindow };
	std::unique_ptr<LvSwapChain> lvSwapChain;
	std::unique_ptr<LvPipeline> lvPipeline;
	VkPipelineLayout pipelineLayout;
	std::vector<VkCommandBuffer> commandBuffers;
	std::unique_ptr<LvModel> lvModel;
};

